#ifndef EXPORTTABLE_H
#define EXPORTTABLE_H

#include"xlsxdocument.h"
#include "xlsxformat.h"
#include "xlsxcellrange.h"
#include "memberclass.h"
#include "myday.h"

#include <QWidget>

class ExportTable : public QWidget
{
    Q_OBJECT
public:
    explicit ExportTable(QWidget *parent = nullptr);

private:
    void startExportTable(QList<MemberClass*> memberList, QList<myDay*> dayList);
    void createTableSheet();
    void setXlsxHeadFormat();
    void setXlsxItemFormat();
    void writeHead(QList<MemberClass*> &memberList, QList<myDay*> &dayList);
    void writeItem(QList<MemberClass*> &memberList, QList<myDay*> &dayList);
    void writeSpecialItem(QList<MemberClass*> &memberList, QList<myDay*> &dayList);
    void exportXlsx();
signals:

public slots:
    void slot_exportTable_triggered(QList<MemberClass*> memberList, QList<myDay*> dayList);

private:
    QXlsx::Document *pXlsx;
    QXlsx::Format *pHeadFormat;
    QXlsx::Format *pSpecialHeadFormat;
    QXlsx::Format *pItemDayFormat;
    QXlsx::Format *pItemNightFormat;
    QXlsx::Format *pItemCommonFormat;
    QXlsx::Format *pItemSpeciaFormat;
};

#endif // EXPORTTABLE_H
